<template>
  <div class="son">
    <!-- 使用组件 -->
    <my-header></my-header>
    <my-goods v-for="item in list" :key="item.id" :goods="item"></my-goods>
    <my-footer :list="list"></my-footer>
  </div>
</template>

<script>
//引入组件
import MyHeader from "./components/MyHeader.vue";
import MyGoods from "./components/MyGoods.vue";
import MyFooter from "./components/MyFooter.vue";
export default {
  //注册组件
  components: {
    MyHeader,
    MyGoods,
    MyFooter,
  },
  data() {
    return {
      title: "购物车",
      list: [],
    };
  },

  //发送AJAX
  async created() {
    let res = await this.$http({ url: "/api/cart" });
    this.list = res.data.list;
  },

  methods: {},
};
</script>

<style lang="less" scoped>
.son {
  padding: 45px 0 50px 0;
}
</style>